<template>
  <!-- 组件想要全局使用 就必须进行全局注册
    全局注册方法
        在main.js中使用Vue.component('组件名',导入的组件)
 -->
  <van-nav-bar
    class="hmNavBar"
    @click-left="$router.push(path)"
    @click-right="rightEvent"
  >
    <template #left>
      <div class="iconfont" style="font-size:50px">
        &#xe637;
      </div>
    </template>
    <template #title>
      <div class="title">
        {{ title }}
      </div>
    </template>
    <template #right>
      <div class="right">
        {{ right }}
      </div>
    </template>
  </van-nav-bar>
</template>

<script>
export default {
  name: 'hmNavBar',
  props: ['title', 'path', 'right'],
  methods: {
    rightEvent () {
      this.$emit('rightClick')
    }
  }
}
</script>

<style lang="less" scoped>
.hmNavBar {
  ::v-deep .van-nav-bar__left,
  ::v-deep .van-nav-bar__right {
    padding: 0;
  }
  .title {
    opacity: 1;
    font-size: 18px;
    font-family: PingFangSC, PingFangSC-Semibold;
    font-weight: 600;
    text-align: center;
    color: #222222;
    line-height: 25px;
    letter-spacing: 0px;
  }
  .right {
    padding-right: @p15;
    opacity: 1;
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: right;
    color: #181a39;
    line-height: 20px;
    letter-spacing: 0px;
  }
}
</style>
